<!--partner_order_list-->
<style>
.order-research td{white-space: nowrap;}
.order-list {margin: 2em 0;text-align: center;}
.order-list tr{border-bottom: 1px solid #e3e3e3;}
.order-list th{background: #e8e9eb;font-weight: normal;}
.order-list td{vertical-align:middle;}
</style>
<div class="heading">
  <strong><?php echo L('_Order_1');?></strong>
</div>
<form method="post" id="form_order">
  <ul class="row">
    <li class="col-md-4">
      <span class="col-md-5"><?php echo L('orderstatus');?>：</span>
      <div class="select-widget col-md-7">
        <i></i>
        <span id="order_status_name"><?php echo $order_result['name'];?></span>
        <select name="order_status" id="order_status" >
          <option value="" <?php if("" == $order_result['osid'])echo 'selected';?> ><?php echo L('any')?></option>
          <?php foreach (OrderModel::$orderStatus as $key => $val): if($key == 0) $key = 100;?>
          <option value="<?php echo $key;?>" <?php if($key == $order_result['osid'])echo 'selected';?>><?php echo L($val);?></option>
          <?php endforeach;?>
        </select>
      </div>
    </li>
    <li class="col-md-5">
      <span class="col-md-5"><?php echo L('paystatus');?>：</span>
      <div class="select-widget col-md-7">
        <i></i>
        <span id="payment_status_name"><?php echo $payment_result['name']?> </span>
        <select name="payment_status" id="payment_status" >
          <option value="" <?php if("" == $payment_result['psid'])echo 'selected';?> ><?php echo L('any')?></option>
          <?php foreach (OrderModel::$paymentStatus as $key => $val): if($key == 0) $key = 100;?>
          <option value="<?php echo $key;?>" <?php if($key == $payment_result['psid'])echo 'selected';?>><?php echo L($val);?></option>
          <?php endforeach;?>
        </select>
      </div>
    </li>
    <li class="col-md-3 search-order">
      <input type="text" name="order_sn" value="<?php echo $order_sn;?>">
      <button type="submit"></button>
    </li>
  </ul>
</form>
<table class="order-list">
  <tr>
    <th><?php echo L('ordersn');?></th>
    <th><?php echo L('_name_');?></th>
    <th><?php echo L('goods_total');?></th>
    <th><?php echo L('paid_amount');?></th>
    <th><?php echo L('completed_order');?></th>
    <th><?php echo L('orderstatus');?></th>
    <th><?php echo L('_ACTION_');?></th>
  </tr>
  <?php foreach ($ordersList as $k => $order) : ?>
  <?php if($order['order_status'] != -2):?>
  <tr>
    <td><?php echo $order['order_sn'];?></td>
    <td><?php echo $order['delivery_first_name'].' '.$order['delivery_last_name'];?></td>
    <td><?php echo isset($order['order_amount']) ? currency($order['order_amount']) : null; ?></td>
    <td><?php echo isset($order['pay_amount']) ? currency($order['pay_amount']) : null; ?></td>
    <td><?php echo date('d-m-Y H:i:s',$order['start_time'])?></td>
    <td>
      <?php echo L(OrderModel::$orderStatus[$order['order_status']]);?> / <?php if($order['return_status']){ echo $order['return_status'];}else{echo L(OrderModel::$paymentStatus[$order['payment_status']]);}?> / <?php echo L(OrderModel::$shippingStatus[$order['shipping_status']]);?>
        <?php
        if($order['shipping_status'] == OrderModel::SHIPPING_UNSHIPPED && $orderInfo['is_gift_orders']!=1){
        $orderslogs = array();
        $orderslogs = M('orders_log')->where(array('order_id' => $order['id']))->order('id DESC')->select();
          if($orderslogs){
              foreach($orderslogs as $kkk => $vvv){
                  if($vvv['shipping_status'] == 99){
                      echo '/ '.L('_PROCESSING_');
                      break;
                  }
              }
          }
        }
        ?>
      </td>
      <td>
        <a href="<?php echo url('partner/order_info', 'oid='.$order['id']);?>"><?php echo L('orderdetailed')?></a>
        <?php if($order['order_status'] == OrderModel::ORDER_UNCONFIRMED && $order['payment_status'] == OrderModel::PAY_UNPAYED) : ?>
        <br>
        <a href="javascript:;" title="<?php echo L('order_cancel');?>" data-order-id="<?php echo $order['id'];?>" class="js-cancel-order"><?php echo L('order_cancel')?></a>
        <?php endif; ?>
        <?php if($order['order_status'] == OrderModel::ORDER_UNCONFIRMED && $order['payment_status'] == OrderModel::PAY_UNPAYED) : echo isset($order['paymentSubmit']) ? $order['paymentSubmit'] : null; endif; ?>
      </td>
    </tr>
    <?php endif;?>
    <?php endforeach; ?>
</table>
<div class="align-right">
  <span class="pageTurn"><?php echo $pageShow?></span>
</div>

<script src="/statics/js/WdatePicker/WdatePicker.js"></script>
<script>
$(function () {
  (function () {//订单筛选
    function orderSearch(){
      var osid = $('#order_status').val(),
          psid = $('#payment_status').val();
      window.location.href = '/partner/order_list/order_status/' + osid + '/payment_status/' + psid;
    }
    $('#order_status').on('change', function () {
      orderSearch();
    });

    $('#payment_status').on('change', function () {
      orderSearch();
    });
  }());

  $('.js-cancel-order').popupBox({
    quickClose: true,
    button: ["<?php echo L('yes');?>", "<?php echo L('no');?>"],
    content: "<h3 class='align-center normal'><?php echo L('order_cancel_confirm');?></h3>",
    beforeShow: function (trigger, popupBox) {
      popupBox.css('max-width', 500);
    },
    onOk: function (trigger, popupBox) {
      var orderId = trigger.data('orderId');
      window.location.href = url('partner/order_cancel/oid/' + orderId);
    }
  });
});
</script>